﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <p>Input some number and press check to return last digit</p>
    <input type="text" id="digit-tb" />
    <button id="btn" onclick="checkLastDigit(parseInt(document.getElementById('digit-tb').value))">Check</button>
    <div id="js-console"></div>
    <script src="../scripts/js-console.js"></script>
    <script>
        function checkLastDigit(number) {
            var lastDigit = number % 10;
            switch (lastDigit) {
                case 0: jsConsole.writeLine('Zero'); break;
                case 1: jsConsole.writeLine('One'); break;
                case 2: jsConsole.writeLine('Two'); break;
                case 3: jsConsole.writeLine('Three'); break;
                case 4: jsConsole.writeLine('Four'); break;
                case 5: jsConsole.writeLine('Five'); break;
                case 6: jsConsole.writeLine('Six'); break;
                case 7: jsConsole.writeLine('Seven'); break;
                case 8: jsConsole.writeLine('Eight'); break;
                case 9: jsConsole.writeLine('Nine'); break;
                default: jsConsole.writeLine('Invalid digit');
            }
        }
    </script>
</body>
</html>
